package com.tc.quartz.support.bean;

import com.tc.quartz.frame.base.BaseModel;
import com.tc.quartz.frame.common.Constant;
import com.tc.quartz.frame.common.DateUtil;
import org.apache.commons.collections.MapUtils;
import org.quartz.JobDataMap;

/**
 * desc：VqrtzJobsViews
 * @author yongjin.ye
 */
public class JobManagerBean extends BaseModel {

	private static final long serialVersionUID = 1L;

	/** id */
	private String id;
	/** dtlSchedName */
	private String dtlSchedName;
	/** dtlJobName */
	private String dtlJobName;
	/** dtlJobGroup */
	private String dtlJobGroup;
	/** dtlJobGroupOld,用于判断是否修改了分组 */
	private String dtlJobGroupOld;
	/** dtlDescription */
	private String dtlDescription;
	/** dtlJobClassName */
	private String dtlJobClassName;
	/** dtlIsDurable */
	private String dtlIsDurable;
	/** dtlIsNonconcurrent */
	private String dtlIsNonconcurrent;
	/** dtlIsUpdateData */
	private String dtlIsUpdateData;
	/** dtlRequestsRecovery */
	private String dtlRequestsRecovery;
	/** dtlJobData */
	private byte[] dtlJobData;
	/** trigSchedName */
	private String trigSchedName;
	/** trigTriggerName */
	private String trigTriggerName;
	/** trigTriggerGroup */
	private String trigTriggerGroup;
	/** trigJobName */
	private String trigJobName;
	/** trigJobGroup */
	private String trigJobGroup;
	/** trigDescription */
	private String trigDescription;
	/** trigNextFireTime */
	private Long trigNextFireTime;
	/** trigPrevFireTime */
	private Long trigPrevFireTime;
	/** trigPriority */
	private Long trigPriority;
	/** trigTriggerState */
	private String trigTriggerState;
	/** trigTriggerType */
	private String trigTriggerType;
	/** trigStartTime */
	private Long trigStartTime;
	private String trigStartTimeStr;
	/** trigEndTime */
	private Long trigEndTime;
	private String trigEndTimeStr;
	/** trigCalendarName */
	private String trigCalendarName;
	/** trigMisfireInstr */
	private Integer trigMisfireInstr;
	/** trigJobData */
	private byte[] trigJobData;
	/** cronSchedName */
	private String cronSchedName;
	/** cronTriggerName */
	private String cronTriggerName;
	/** cronTriggerGroup */
	private String cronTriggerGroup;
	/** cronCronExpression */
	private String cronCronExpression;
	/** cronTimeZoneId */
	private String cronTimeZoneId;

	private JobDataMap jobDataMap;

	//页面传参过来使用
	private String jobDataStr;
	private String triggerJobDataStr;

	// --------- get set 方法 ---------

	/** get dtlSchedName */
	public String getDtlSchedName() {
		return this.dtlSchedName;
	}

	/** set dtlSchedName */
	public void setDtlSchedName(String dtlSchedName) {
		this.dtlSchedName = dtlSchedName;
	}

	/** get dtlJobName */
	public String getDtlJobName() {
		return this.dtlJobName;
	}

	/** set dtlJobName */
	public void setDtlJobName(String dtlJobName) {
		this.dtlJobName = dtlJobName;
	}

	/** get dtlJobGroup */
	public String getDtlJobGroup() {
		return this.dtlJobGroup;
	}

	/** set dtlJobGroup */
	public void setDtlJobGroup(String dtlJobGroup) {
		this.dtlJobGroup = dtlJobGroup;
	}

	/** get dtlDescription */
	public String getDtlDescription() {
		return this.dtlDescription;
	}

	/** set dtlDescription */
	public void setDtlDescription(String dtlDescription) {
		this.dtlDescription = dtlDescription;
	}

	/** get dtlJobClassName */
	public String getDtlJobClassName() {
		return this.dtlJobClassName;
	}

	/** set dtlJobClassName */
	public void setDtlJobClassName(String dtlJobClassName) {
		this.dtlJobClassName = dtlJobClassName;
	}

	/** get dtlIsDurable */
	public String getDtlIsDurable() {
		return this.dtlIsDurable;
	}

	/** set dtlIsDurable */
	public void setDtlIsDurable(String dtlIsDurable) {
		this.dtlIsDurable = dtlIsDurable;
	}

	/** get dtlIsNonconcurrent */
	public String getDtlIsNonconcurrent() {
		return this.dtlIsNonconcurrent;
	}

	/** set dtlIsNonconcurrent */
	public void setDtlIsNonconcurrent(String dtlIsNonconcurrent) {
		this.dtlIsNonconcurrent = dtlIsNonconcurrent;
	}

	/** get dtlIsUpdateData */
	public String getDtlIsUpdateData() {
		return this.dtlIsUpdateData;
	}

	/** set dtlIsUpdateData */
	public void setDtlIsUpdateData(String dtlIsUpdateData) {
		this.dtlIsUpdateData = dtlIsUpdateData;
	}

	/** get dtlRequestsRecovery */
	public String getDtlRequestsRecovery() {
		return this.dtlRequestsRecovery;
	}

	/** set dtlRequestsRecovery */
	public void setDtlRequestsRecovery(String dtlRequestsRecovery) {
		this.dtlRequestsRecovery = dtlRequestsRecovery;
	}

	/** get dtlJobData */
	public byte[] getDtlJobData() {
		return this.dtlJobData;
	}

	/** set dtlJobData */
	public void setDtlJobData(byte[] dtlJobData) {
		this.dtlJobData = dtlJobData;
	}

	/** get trigSchedName */
	public String getTrigSchedName() {
		return this.trigSchedName;
	}

	/** set trigSchedName */
	public void setTrigSchedName(String trigSchedName) {
		this.trigSchedName = trigSchedName;
	}

	/** get trigTriggerName */
	public String getTrigTriggerName() {
		return this.trigTriggerName;
	}

	/** set trigTriggerName */
	public void setTrigTriggerName(String trigTriggerName) {
		this.trigTriggerName = trigTriggerName;
	}

	/** get trigTriggerGroup */
	public String getTrigTriggerGroup() {
		return this.trigTriggerGroup;
	}

	/** set trigTriggerGroup */
	public void setTrigTriggerGroup(String trigTriggerGroup) {
		this.trigTriggerGroup = trigTriggerGroup;
	}

	/** get trigJobName */
	public String getTrigJobName() {
		return this.trigJobName;
	}

	/** set trigJobName */
	public void setTrigJobName(String trigJobName) {
		this.trigJobName = trigJobName;
	}

	/** get trigJobGroup */
	public String getTrigJobGroup() {
		return this.trigJobGroup;
	}

	/** set trigJobGroup */
	public void setTrigJobGroup(String trigJobGroup) {
		this.trigJobGroup = trigJobGroup;
	}

	/** get trigDescription */
	public String getTrigDescription() {
		return this.trigDescription;
	}

	/** set trigDescription */
	public void setTrigDescription(String trigDescription) {
		this.trigDescription = trigDescription;
	}

	/** get trigNextFireTime */
	public Long getTrigNextFireTime() {
		return this.trigNextFireTime;
	}

	/** set trigNextFireTime */
	public void setTrigNextFireTime(Long trigNextFireTime) {
		this.trigNextFireTime = trigNextFireTime;
	}

	/** get trigPrevFireTime */
	public Long getTrigPrevFireTime() {
		return this.trigPrevFireTime;
	}

	/** set trigPrevFireTime */
	public void setTrigPrevFireTime(Long trigPrevFireTime) {
		this.trigPrevFireTime = trigPrevFireTime;
	}

	/** get trigPriority */
	public Long getTrigPriority() {
		return this.trigPriority;
	}

	/** set trigPriority */
	public void setTrigPriority(Long trigPriority) {
		this.trigPriority = trigPriority;
	}

	/** get trigTriggerState 状态翻译 */
	public String getTrigTriggerStateDesc() {
		return MapUtils.getString(Constant.QUARTZ_STATE_MAP, this.trigTriggerState, this.trigTriggerState);
	}

	/** get trigTriggerState */
	public String getTrigTriggerState() {
		return this.trigTriggerState;
	}

	/** set trigTriggerState */
	public void setTrigTriggerState(String trigTriggerState) {
		this.trigTriggerState = trigTriggerState;
	}

	/** get trigTriggerType */
	public String getTrigTriggerType() {
		return this.trigTriggerType;
	}

	/** set trigTriggerType */
	public void setTrigTriggerType(String trigTriggerType) {
		this.trigTriggerType = trigTriggerType;
	}

	/** get trigStartTime */
	public Long getTrigStartTime() {
		return this.trigStartTime;
	}
	/** set trigStartTime */
	public void setTrigStartTime(Long trigStartTime) {
		this.trigStartTime = trigStartTime;
	}

	/** get trigEndTime */
	public Long getTrigEndTime() {
		return this.trigEndTime;
	}

	/** set trigEndTime */
	public void setTrigEndTime(Long trigEndTime) {
		this.trigEndTime = trigEndTime;
	}

	/** get trigCalendarName */
	public String getTrigCalendarName() {
		return this.trigCalendarName;
	}

	/** set trigCalendarName */
	public void setTrigCalendarName(String trigCalendarName) {
		this.trigCalendarName = trigCalendarName;
	}

	/** get trigMisfireInstr */
	public Integer getTrigMisfireInstr() {
		return this.trigMisfireInstr;
	}

	/** set trigMisfireInstr */
	public void setTrigMisfireInstr(Integer trigMisfireInstr) {
		this.trigMisfireInstr = trigMisfireInstr;
	}

	/** get trigJobData */
	public byte[] getTrigJobData() {
		return this.trigJobData;
	}

	/** set trigJobData */
	public void setTrigJobData(byte[] trigJobData) {
		this.trigJobData = trigJobData;
	}

	/** get cronSchedName */
	public String getCronSchedName() {
		return this.cronSchedName;
	}

	/** set cronSchedName */
	public void setCronSchedName(String cronSchedName) {
		this.cronSchedName = cronSchedName;
	}

	/** get cronTriggerName */
	public String getCronTriggerName() {
		return this.cronTriggerName;
	}

	/** set cronTriggerName */
	public void setCronTriggerName(String cronTriggerName) {
		this.cronTriggerName = cronTriggerName;
	}

	/** get cronTriggerGroup */
	public String getCronTriggerGroup() {
		return this.cronTriggerGroup;
	}

	/** set cronTriggerGroup */
	public void setCronTriggerGroup(String cronTriggerGroup) {
		this.cronTriggerGroup = cronTriggerGroup;
	}

	/** get cronCronExpression */
	public String getCronCronExpression() {
		return null != this.cronCronExpression ? this.cronCronExpression.trim() : "临时任务";
	}

	/** set cronCronExpression */
	public void setCronCronExpression(String cronCronExpression) {
		this.cronCronExpression = cronCronExpression;
	}

	/** get cronTimeZoneId */
	public String getCronTimeZoneId() {
		return this.cronTimeZoneId;
	}

	/** set cronTimeZoneId */
	public void setCronTimeZoneId(String cronTimeZoneId) {
		this.cronTimeZoneId = cronTimeZoneId;
	}

	public String getTrigStartTimeStr() {
		return trigStartTimeStr;
	}

	public void setTrigStartTimeStr(String trigStartTimeStr) {
		this.trigStartTimeStr = trigStartTimeStr;
	}

	public String getTrigEndTimeStr() {
		return trigEndTimeStr;
	}

	public void setTrigEndTimeStr(String trigEndTimeStr) {
		this.trigEndTimeStr = trigEndTimeStr;
	}

	public JobDataMap getJobDataMap() {
		if (null == this.jobDataMap) {
			jobDataMap = new JobDataMap();
		}
		return jobDataMap;
	}

	public void setJobDataMap(JobDataMap jobDataMap) {
		this.jobDataMap = jobDataMap;
	}

	public String getDtlJobGroupOld() {
		return dtlJobGroupOld;
	}

	public void setDtlJobGroupOld(String dtlJobGroupOld) {
		this.dtlJobGroupOld = dtlJobGroupOld;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getJobDataStr() {
		return jobDataStr;
	}

	public void setJobDataStr(String jobDataStr) {
		this.jobDataStr = jobDataStr;
	}

	public String getTriggerJobDataStr() {
		return triggerJobDataStr;
	}

	public void setTriggerJobDataStr(String triggerJobDataStr) {
		this.triggerJobDataStr = triggerJobDataStr;
	}
	
	//------------日期格式化-------
	

	/** get dtlJobData */
	public String getDtlJobDataDesc() {
		return new String(null == this.getDtlJobData() ? (new byte[] {}) : this.getDtlJobData());
	}
	
	public String getTrigJobDataDesc() {
		return new String(null == this.getTrigJobData() ? (new byte[] {}) : this.getTrigJobData());
	}

	public String getTrigNextFireTimeFormat() {
		return DateUtil.formatDate(this.trigNextFireTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}
	
	public String getTrigPrevFireTimeFormat() {
		return DateUtil.formatDate(this.trigPrevFireTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}

	public String getTrigEndTimeFormat() {
		return DateUtil.formatDate(this.trigEndTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}

	public String getTrigEndTimeDescFormat2() {
		return DateUtil.formatDate(this.trigEndTime, "yyyy-MM-dd");
	}

	public String getTrigStartTimeFormat() {
		return DateUtil.formatDate(this.trigStartTime, "yyyy-MM-dd HH:mm:ss:SSS");
	}

	public String getTrigStartTimeFormat2() {
		return DateUtil.formatDate(this.trigStartTime, "yyyy-MM-dd");
	}
}